<?php
	//page message
	HtmlsHelper::Message($this->data['message']);

	//IE CSS hack
	echo '
		<!--[if lt IE 10]>
			<style>#profileLoagingImage, #languagesLoagingImage, #locationsLoagingImage, #interestsLoagingImage {margin: 0px 0px 1px 0px;}</style>
		<![endif]-->	
	';	
	
    //PROFILE BLOCK
	echo "
		<ul>
			<li class='mainbox white-corners'>";
	echo '		<form action = "#" method = "POST" id = "profileForm" style = "margin-bottom: 0px; padding-bottom: 0px; " onsubmit = " $(\'#profileButton\').hide(); $(\'#profileLoagingImage\').show(); '.jQuery::Post('/customers/updateprofile/', 'profileForm', 'OnProfileUpdate').' return false; ">';
	echo "		<div class='box-header clear'>
					<div class='box-title-blue fl_left'>".Language::Get('Profile')."<span id = 'profileResultContainer'></span></div>
					<div class='box-control fl_right'>
					</div>
				</div>
				<div class='box-cnt'>";
    
    				//profile info
                    $this->helpers->htmlx->InputTextRowSite3(Language::Get('First Name'), 'firstName', $this->data[$this->name]['firstName']);
                    $this->helpers->htmlx->InputTextRowSite3(Language::Get('Last Name'), 'lastName', $this->data[$this->name]['lastName']);
                    $this->helpers->htmlx->InputTextRowSite3(Language::Get('Nickname'), 'nickname', $this->data[$this->name]['nickname']);
                    $this->helpers->htmlx->InputTextRowSite3(Language::Get('Phone'), 'phone', $this->data[$this->name]['phone']);
                    XHTML::InputHidden('uuid', $this->data[$this->name]['uuid']);
                    $this->helpers->htmlx->InputSubmitRowSite3('search', 'Update', " id = 'profileButton' ");
                    XHTML::Img(SITE_IMAGES."loader16x16.gif", "Loading...", array('width' => '16', 'height' => '16', 'id' => 'profileLoagingImage', 'style' => 'display: none; '));

	echo "		</div> 
				</form>                
			</li>";
	
	//INTERESTS BLOCK
	echo '	<li class="mainbox white-corners">
				<form action = "#" method = "POST" id = "interestsForm" style = "margin-bottom: 0px; padding-bottom: 0px; " onsubmit = " $(\'#interestsButton\').hide(); $(\'#interestsLoagingImage\').show(); '.jQuery::Post('/customers/updateinterests/', 'interestsForm', 'OnInterestsUpdate').' return false; ">';
	echo "		<div class='box-header clear'>
					<div class='box-title-blue fl_left'>".Language::Get('Interests')."<span id = 'interestsResultContainer'></span></div>
					<div class='box-control fl_right'></div>
				</div>
				<div class='box-cnt'>";
	
					//interests
					foreach ($this->data['selected_interests'] as $keyInt => $interest)
					{
						echo "<div class = 'fld_wrap'>";
							XHTML::Select("interests[$keyInt]", $this->data['reference']['interests'], $interest, '-', array('class' => 'fldselect'));
						echo "</div>";
					}
					for ($i = 100; $i < 105; $i++)
					{
						echo "<div class = 'fld_wrap'>";
							XHTML::Select("interests[$i]", $this->data['reference']['interests'], NULL, '-', array('class' => 'fldselect'));
						echo "</div>";
					}
	
	                XHTML::InputHidden('uuid', $this->data[$this->name]['uuid']);
                    $this->helpers->htmlx->InputSubmitRowSite3('search', 'Update', " id = 'interestsButton' ");
                    XHTML::Img(SITE_IMAGES."loader16x16.gif", "Loading...", array('width' => '16', 'height' => '16', 'id' => 'interestsLoagingImage', 'style' => 'display: none; '));
	
	echo "		</div>
				</form>
			</li>
		</ul>";

	//LOCATIONS BLOCK
	echo '
		<ul>
			<li class="mainbox white-corners">
				<form action = "#" method = "POST" id = "locationsForm" style = "margin-bottom: 0px; padding-bottom: 0px; " onsubmit = " $(\'#locationsButton\').hide(); $(\'#locationsLoagingImage\').show(); '.jQuery::Post('/customers/updatelocations/', 'locationsForm', 'OnLocationsUpdate').' return false; ">';
	echo "		<div class='box-header clear'>
					<div class='box-title-blue fl_left'>".Language::Get('Locations')."<span id = 'locationsResultContainer'></span></div>
					<div class='box-control fl_right'></div>
				</div>
				<div class='box-cnt'>";
	
					//locations
					foreach ($this->data['selected_locations'] as $keyLoc => $location)
					{
						echo "<div class = 'fld_wrap'>";
							XHTML::Select("locations[$keyLoc][geoLocationUuid]", $this->data['reference']['locations'], $location['geoLocationUuid'], '-', array('class' => 'fldselect'));
							XHTML::InputRadio("primaryResidenceIndicator", $keyLoc, $location['primaryResidenceIndicator'], array('id' => 'isPrimaryResidence'.$keyLoc));
							echo "<label for = 'isPrimaryResidence$keyLoc'>primary residence</label>";
						echo "</div>";
					}
					for ($l = 100; $l < 105; $l++)
					{
						echo "<div class = 'fld_wrap'>";
							XHTML::Select("locations[$l][geoLocationUuid]", $this->data['reference']['locations'], NULL, '-', array('class' => 'fldselect'));
							XHTML::InputRadio("primaryResidenceIndicator", $l, 0, array('id' => 'isPrimaryResidence'.$l));
							echo "<label for = 'isPrimaryResidence$l'>primary residence</label>";
						echo "</div>";
					}
	
	                XHTML::InputHidden('uuid', $this->data[$this->name]['uuid']);
                    $this->helpers->htmlx->InputSubmitRowSite3('search', 'Update', " id = 'locationsButton' ");
                    XHTML::Img(SITE_IMAGES."loader16x16.gif", "Loading...", array('width' => '16', 'height' => '16', 'id' => 'locationsLoagingImage', 'style' => 'display: none; '));
	                	
	echo "		</div>  
				</form>              
			</li>";
	
	//LANGUAGES BLOCK
	echo '	<li class="mainbox white-corners">
				<form action = "#" method = "POST" id = "languagesForm" style = "margin-bottom: 0px; padding-bottom: 0px; " onsubmit = " $(\'#languagesButton\').hide(); $(\'#languagesLoagingImage\').show(); '.jQuery::Post('/customers/updatelanguages/', 'languagesForm', 'OnLanguagesUpdate').' return false; ">';
	echo "		<div class='box-header clear'>
					<div class='box-title-blue fl_left'>".Language::Get('Languages', 'CAPITALIZE')."<span id = 'languagesResultContainer'></span></div>
					<div class='box-control fl_right'></div>
				</div>
				<div class='box-cnt'>";

					//languages
					foreach ($this->data['selected_languages'] as $keyLang => $language)
					{
						echo "<div class = 'fld_wrap'>";
							XHTML::Select("languages[$keyLang][languageUuid]", $this->data['reference']['languages'], $language['languageUuid'], '-', array('class' => 'fldselect'));
							XHTML::InputCheckbox("languages[$keyLang][nativeIndicator]", 0, 1, array('style' => 'display: none; '));
							XHTML::InputCheckbox("languages[$keyLang][nativeIndicator]", 1, $language['nativeIndicator'], array('id' => 'isNative'.$keyLang));
							echo "<label for = 'isNative$keyLang'> Native &nbsp;&nbsp;</label>";
							XHTML::InputCheckbox("languages[$keyLang][canReadIndicator]", 0, 1, array('style' => 'display: none; '));
							XHTML::InputCheckbox("languages[$keyLang][canReadIndicator]", 1, $language['canReadIndicator'], array('id' => 'isRead'.$keyLang));
							echo "<label for = 'isRead$keyLang'> Read &nbsp;&nbsp;</label>";
							XHTML::InputCheckbox("languages[$keyLang][canWriteIndicator]", 0, 1, array('style' => 'display: none; '));
							XHTML::InputCheckbox("languages[$keyLang][canWriteIndicator]", 1, $language['canWriteIndicator'], array('id' => 'isWrite'.$keyLang));
							echo "<label for = 'isWrite$keyLang'> Write </label>";
						echo "</div>";
					}
					for ($j = 100; $j < 105; $j++)
					{
						echo "<div class = 'fld_wrap'>";
							XHTML::Select("languages[$j][languageUuid]", $this->data['reference']['languages'], NULL, '-', array('class' => 'fldselect'));
							XHTML::InputCheckbox("languages[$j][nativeIndicator]", 0, 1, array('style' => 'display: none; '));
							XHTML::InputCheckbox("languages[$j][nativeIndicator]", 1, 0, array('id' => 'isNative'.$j));
							echo "<label for = 'isNative$j'> Native &nbsp;&nbsp;</label>";
							XHTML::InputCheckbox("languages[$j][canReadIndicator]", 0, 1, array('style' => 'display: none; '));
							XHTML::InputCheckbox("languages[$j][canReadIndicator]", 1, 0, array('id' => 'isRead'.$j));
							echo "<label for = 'isRead$j'> Read &nbsp;&nbsp;</label>";
							XHTML::InputCheckbox("languages[$j][canWriteIndicator]", 0, 1, array('style' => 'display: none; '));
							XHTML::InputCheckbox("languages[$j][canWriteIndicator]", 1, 0, array('id' => 'isWrite'.$j));
							echo "<label for = 'isWrite$j'> Write </label>";
						echo "</div>";
					}
	
	                XHTML::InputHidden('uuid', $this->data[$this->name]['uuid']);
                    $this->helpers->htmlx->InputSubmitRowSite3('search', 'Update', " id = 'languagesButton' ");
                    XHTML::Img(SITE_IMAGES."loader16x16.gif", "Loading...", array('width' => '16', 'height' => '16', 'id' => 'languagesLoagingImage', 'style' => 'display: none; '));
	                	
	echo "		</div>
				</form>               
			</li>
		</ul>
    ";
	
	//AJAX SCRIPTS
	XHTML::Script('text/javascript', "
		function OnProfileUpdate(data) 
		{
			$('#profileLoagingImage').hide();
			$('#profileButton').show();
			$('#profileResultContainer').html(data);	
		}
		function OnInterestsUpdate(data) 
		{
			$('#interestsLoagingImage').hide();
			$('#interestsButton').show();
			$('#interestsResultContainer').html(data);	
		}
		function OnLocationsUpdate(data) 
		{
			$('#locationsLoagingImage').hide();
			$('#locationsButton').show();
			$('#locationsResultContainer').html(data);	
		}
		function OnLanguagesUpdate(data) 
		{
			$('#languagesLoagingImage').hide();
			$('#languagesButton').show();
			$('#languagesResultContainer').html(data);	
		}
	");
	
?>